package com.google.bitcoin.core;

import java.math.BigInteger;
import com.google.bitcoin.script.*;
import static com.google.bitcoin.script.ScriptOpCodes.*;

public class OracleContractTransaction extends Transaction {
    private static final long serialVersionUID = 0;

    private OracleBinaryContractExpression expression;

    public OracleContractTransaction(NetworkParameters params, OracleBinaryContractExpression expression, BigInteger amount) {
        super(params);
        this.expression = expression;
        ScriptBuilder sb = new ScriptBuilder();
        sb.op(OP_HASH160);
        sb.data(Utils.sha256hash160(expression.getScript().getProgram()));
        sb.op(OP_EQUAL);
        this.addOutput(amount, sb.build());
    }

    public OracleBinaryContractExpression getExpression() {
        return expression;
    }
}
